<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Flask Blog</title>
    <link rel="stylesheet" href="{{ url_for('static', filename='css/style.css') }}">
</head>
<body>
    <nav>
        <a href="{{ url_for('main.index') }}">Home</a>
        {% if current_user.is_authenticated %}
            <a href="{{ url_for('main.create_post') }}">Create Post</a>
            <a href="{{ url_for('main.logout') }}">Logout ({{ current_user.username }})</a>
        {% else %}
            <a href="{{ url_for('main.login') }}">Login</a>
            <a href="{{ url_for('main.register') }}">Register</a>
        {% endif %}
    </nav>
    <div class="container">
        {% with messages = get_flashed_messages(with_categories=true) %}
            {% if messages %}
                {% for category, message in messages %}
                    <div class="alert alert-{{ category }}">{{ message }}</div>
                {% endfor %}
            {% endif %}
        {% endwith %}
        {% block content %}{% endblock %}
    </div>

    <script src="{{ url_for('static', filename='js/script.js') }}"></script>
    <script src="{{ url_for('static', filename='js/form_validation.js') }}"></script>
    <script src="{{ url_for('static', filename='js/preview.js') }}"></script>
    <script src="{{ url_for('static', filename='js/navbar.js') }}"></script>
</body>
</html>
